from django.db import models
#from django.test import TestCase

# Create your models here.
class Amputee(models.Model):
    REGISTERED_BY = ((0,'self'),(1,'next of kin'))
    first_name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=100,blank=True)
    age = models.PositiveIntegerField(default=0)
    sex  = models.CharField(max_length=1)
    phone_number = models.CharField(max_length=50, default="00 00 00 00")
    registered_by = models.CharField(max_length=100, choices=REGISTERED_BY, default=0)
    date_created = models.DateTimeField(auto_now_add=True)
    last_modified = models.DateTimeField(auto_now=True)



class Ampuation(models.Model):
    BODY_PART = (('arm','Arm'),('leg','Leg'), ('hand', 'Hand'), ('foot','Foot'))
    LOCATION = (('upper','Upper'),('lower','Lower'),('mid','Middle'))
    SIDE = (('l','Left'),('r','Right'))
    amputee = models.ForeignKey('Amputee')
    member = models.CharField(max_length=100, choices=BODY_PART) 
    side = models.CharField(max_length=100, choices=SIDE, blank=True)
    location = models.CharField(max_length=100, choices=LOCATION, blank=True)


class Location(models.Model):
    amputee = models.ForeignKey('Amputee')
    country = models.CharField(max_length=100)
    city  = models.CharField(max_length=100,blank=True)
    region  = models.CharField(max_length=100,blank=True)
    latitude  = models.CharField(max_length=100,blank=True)
    longitude  = models.CharField(max_length=100,blank=True)
    date_created = models.DateTimeField(auto_now_add=True)
    last_modified = models.DateTimeField(auto_now=True)

    
